//
//  IncomeViewController.m
//  Doctors
//
//  Created by 王森 on 16/4/13.
//  Copyright © 2016年 王森. All rights reserved.
//

#import "IncomeViewController.h"

@interface IncomeViewController ()

@end

@implementation IncomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTextTitleViewWithFrame:CGRectMake(0, 0, 60, 20) title:@"今日收入详情" fontSize:18];
    [self customTableView];
    self.tableview.separatorStyle = UITableViewCellSeparatorStyleSingleLine;

    
    //    self.tableview.frame=CGRectMake(0, slideControl.bottom, SCREEN_WIDTH, ScreenHeight-64-48-48);
    //
    
    [self addLeftBackBtn:nil];
    
    [self requestData];
    

    // Do any additional setup after loading the view.
}

-(void)requestData
{
    
    
    [self addProgressHUD];
    
    NSDictionary *dictionary=[NSDictionary dictionaryWithObjectsAndKeys: [self getArtisanId],@"artisanId",  nil];
    NSLog(@"订单详情参数：%@",dictionary);
    [[WSNetworkApi shareManager]postWithUrl:@"/artisan/getTodayIncomeInfo" parameters:dictionary option:RequestCenterCachePolicyNormal sucess:^(id responseObject) {
        
        [self removeStatuslable];
        
        NSLog(@"%@",responseObject);
        
        if ([responseObject[@"status"] isEqualToString:@"ok"]) {
            
         self.dataArray=responseObject[@"incomeList"];
        
            
        }
        else{
            
            [self showFailed:responseObject[@"message"]];
            
        }
        
        [self.tableview reloadData];
        
        
    } failur:^(NSError *error) {
        
        [self removeStatuslable];
 
    }];
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 46;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TableCell"];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"TableCell"];
        //        cell.backgroundColor = [UIColor clearColor];
        cell.accessoryType = UITableViewCellAccessoryNone;
        cell.textLabel.textColor=UIColorFromRGB(0x2e2e2f);
       FONTSIZE(cell.textLabel, 14);
        FONTSIZE(cell.detailTextLabel, 14);

        cell.detailTextLabel.textColor=UIColorFromRGB(0x2e2e2f);
        cell.textLabel.text=self.dataArray[indexPath.row][@"content"];
        cell.detailTextLabel.text=self.dataArray[indexPath.row][@"amount"];    }
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
